UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EJMAQQsrfCeyXh11KJTu3KG5n8FWTZMP4zdLM3GlcmM='
WHERE
key_id = 'e341a87665ae77ae228c24ab1239b6f330783bc790c877928e787b8fc1f09c46'
AND (
token = 'EJMAQQsrfCeyXh11KJTu3KG5n8FWTZMP4zdLM3GlcmM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)