UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LPvvx7dUlgCkbZUp80V1secqx2YWIIXgw4hSxUbR25s=' 
WHERE 
  key_id = '5fed70435a7075769f4637b1a4b993835a147b46c8acfe062983dea6ebc730c0' 
  AND (
    token = 'LPvvx7dUlgCkbZUp80V1secqx2YWIIXgw4hSxUbR25s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032