UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qynaRqXDUAUD+j4hfnYTyZaENWe4Is+gU6vftvTLNks='
WHERE
key_id = '4e18eac4f2ae7c76531800c0f8074efa725ffbc8d4b4a8062d965e1ec458e84f'
AND (
token = 'qynaRqXDUAUD+j4hfnYTyZaENWe4Is+gU6vftvTLNks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)