UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NOjAA8pqBFAVmU0pbKfvVCIinn43qGeF/yk09912A0s=' 
WHERE 
  key_id = '8bfe9d29828a22af448a7ab2ac3ac7c4c388678adee30f9bf3c376aaef6031da' 
  AND (
    token = 'NOjAA8pqBFAVmU0pbKfvVCIinn43qGeF/yk09912A0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041