UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GThQglNVOx+/fKqtIap3sBV4iEy1a9VxPn4y8678ukI=' 
WHERE 
  key_id = '88387505685a6207d36013f80f5299963afa1c6d7d68a9d68d4c03ac6c6a0bf1' 
  AND (
    token = 'GThQglNVOx+/fKqtIap3sBV4iEy1a9VxPn4y8678ukI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040