UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V+ZhW6cPQLQACg+KRY9NbPRV/V0E34eidCN+vgylf7U=' 
WHERE 
  key_id = 'eb4a632fb8fff0063e6a34b266c5f81c8e0c3123373a8e0b94d25fbaefed86ad' 
  AND (
    token = 'V+ZhW6cPQLQACg+KRY9NbPRV/V0E34eidCN+vgylf7U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030