UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UoR9QsrgKjCe/lzernyuu7814uz3HmJyyMUs1M4X7AE=' 
WHERE 
  key_id = '386e8d7fb41de4d01022b2c7da1ccc56bcf778e047e4d8476285d9e477cba279' 
  AND (
    token = 'UoR9QsrgKjCe/lzernyuu7814uz3HmJyyMUs1M4X7AE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031