UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y7/cvsaSsQpDqzGQzzgm0Wrr0wlPZFgtg6eLnDnJ+p4=' 
WHERE 
  key_id = 'deeadc909fd3d751e7ec02d59636d42187b90e5b4eca8cc4c48932b479fb7543' 
  AND (
    token = 'Y7/cvsaSsQpDqzGQzzgm0Wrr0wlPZFgtg6eLnDnJ+p4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032