UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dLegPC0XRiNFwsF+8JLBxc2hsB8frG+1jHppFeB1hZQ=' 
WHERE 
  key_id = '8d0adabf92156d1b52593c16e5c2999793434e59aa5dfd2dd651d7a3a7220e04' 
  AND (
    token = 'dLegPC0XRiNFwsF+8JLBxc2hsB8frG+1jHppFeB1hZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030