UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M7+VXx3NP0OxggL0/UiLRmcP/Qpq+w0G80KA+vQHHX4=' 
WHERE 
  key_id = '2a8de95bbb084b78878a928130e23083aef8af51fc4cf55184d9cdca72542614' 
  AND (
    token = 'M7+VXx3NP0OxggL0/UiLRmcP/Qpq+w0G80KA+vQHHX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049