UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6MEt1ssAK0ZwHvqE+v+NgFl56kPWIHHvC2KuBy/A/7w='
WHERE
key_id = 'bc4d1cc3c07da7eb525de563d1757fb7eb9a3321a2565f15b48b13a876fbaa24'
AND (
token = '6MEt1ssAK0ZwHvqE+v+NgFl56kPWIHHvC2KuBy/A/7w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)