UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bU8NSmM8j/A0OBiJ+M4ibvMBzc6otN84fAM8K8yt2OU=' 
WHERE 
  key_id = 'cd352435f0b0e07284d053e305f41ac5d02a60bf3915668f4abd7be833fab036' 
  AND (
    token = 'bU8NSmM8j/A0OBiJ+M4ibvMBzc6otN84fAM8K8yt2OU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034