UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4ApYPfcx5keO/u/3321TEiFB+CBAON/qHN91VctQFeM=' 
WHERE 
  key_id = '63193111b9abceac4850d6c7cf0076b16190f2b5992fc8d134412af065f199f2' 
  AND (
    token = '4ApYPfcx5keO/u/3321TEiFB+CBAON/qHN91VctQFeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024