UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iQ2Vc3ohX3idC7QQ++3z6jSzWHBLEVgywtmaLcbVtOM=' 
WHERE 
  key_id = 'd934794d7cedbab2c5dd0d1c40ed4d6b38f761205e262923f77565ca078c0639' 
  AND (
    token = 'iQ2Vc3ohX3idC7QQ++3z6jSzWHBLEVgywtmaLcbVtOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050