UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tAfRIWTzXRrheFuz7KIM6WsfU6/Rc4Z30pcu2F8Iz34=' 
WHERE 
  key_id = '05d01a1695eded8bfc817ca54f8fedcf266b0fa09882d2713fe4ec761d2fff78' 
  AND (
    token = 'tAfRIWTzXRrheFuz7KIM6WsfU6/Rc4Z30pcu2F8Iz34=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036