UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VdwgdosBQ0tbzWgUUZosQGijrc9DthCaP2cqIdr2Mc8=' 
WHERE 
  key_id = '02f4c638f81ef615ec9c0cffb86d966ca51319d2d87408669939f098508043ef' 
  AND (
    token = 'VdwgdosBQ0tbzWgUUZosQGijrc9DthCaP2cqIdr2Mc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038