UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6XJGchibx1cUemZJO0S2H0pZyj6XyFWe4+sKCF05f30=' 
WHERE 
  key_id = '336b0d2b16ddd9084dd75a6eeb9a0471541c2bc093db89a895cf2538b9b8ff3f' 
  AND (
    token = '6XJGchibx1cUemZJO0S2H0pZyj6XyFWe4+sKCF05f30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028