UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1XD2CUSJal0qZ3gI4MmE0Shynz/Zfbc2Wz1SGY5aoUw=' 
WHERE 
  key_id = '10e27a366b84764a8796c64fb2dbc3c11344ee7c1192f778ad95b5d9f1ac5a1e' 
  AND (
    token = '1XD2CUSJal0qZ3gI4MmE0Shynz/Zfbc2Wz1SGY5aoUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037