UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aJNzkRfUECFTnp0EDdnyKeeC9HN3BpKvnz+LI9lllM8=' 
WHERE 
  key_id = 'f944b94c62781cedae1df9b7412f2c7d417dd663ee6c00d307e63bb57825451f' 
  AND (
    token = 'aJNzkRfUECFTnp0EDdnyKeeC9HN3BpKvnz+LI9lllM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040