UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DItz+I+07PFlC9218xf2lb+mNRJpTibtABCj/3aDsmQ=' 
WHERE 
  key_id = 'f792c6cb25cd6589ab248157ad6397352e67b7c810ab4836a28a29eae2c69de5' 
  AND (
    token = 'DItz+I+07PFlC9218xf2lb+mNRJpTibtABCj/3aDsmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024