UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5k5kHJop7mOB25zr334fXEuQMfbPn8ftvOZda1CygZc='
WHERE
key_id = '0a0be4d174e53eb05fd9a621e2b4afc44f9456ceea4bba9127aeaa77d30868ce'
AND (
token = '5k5kHJop7mOB25zr334fXEuQMfbPn8ftvOZda1CygZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)