UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iJhxm00ekFqcg5ou4G8NdMrg+bI5/RfSLbuh+/NnHjY=' 
WHERE 
  key_id = 'b3bb95db5065e90a2bc2c7b132166f3f6e5eed905d4aa2ed5899c10d98b0d10e' 
  AND (
    token = 'iJhxm00ekFqcg5ou4G8NdMrg+bI5/RfSLbuh+/NnHjY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063