UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ovPyRd2XjyWgsUj10KZH27uiAC9xx37DQOWzsEoJmaQ=' 
WHERE 
  key_id = '561a84d44dc832ba45927fa99435dd0b572f7675aabdcb2d2bbb049269522416' 
  AND (
    token = 'ovPyRd2XjyWgsUj10KZH27uiAC9xx37DQOWzsEoJmaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065