UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yp9gTkYF5q/vfL03PEA7aJyRJggjD+U2L93yzTDa+z4=' 
WHERE 
  key_id = '4993281b2425088bd4f45a75580ff5f45a3ced0abe1be6433629ae07c2ffffc6' 
  AND (
    token = 'yp9gTkYF5q/vfL03PEA7aJyRJggjD+U2L93yzTDa+z4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032