UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'of8mMOR4kdxLkNMpEyyFO206SiK1eOKRg4dXH8TS3ao=' 
WHERE 
  key_id = 'c2ddafce6096e12bc49d7dc97d931953886a51b393f197ac527b8000d2c16d34' 
  AND (
    token = 'of8mMOR4kdxLkNMpEyyFO206SiK1eOKRg4dXH8TS3ao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034