UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lA4j5kGnNLtv4k71l7jmlWbfd70luxt7CRL/pxC3w0Y=' 
WHERE 
  key_id = '6dd6db573f0f6ade2adac5ace253269048a4db5511b12afe1287ea2ed3247416' 
  AND (
    token = 'lA4j5kGnNLtv4k71l7jmlWbfd70luxt7CRL/pxC3w0Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027