UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MsRRdzbm2KzkEbmS66d3maLEfSbsDfl7BSc+fLQgLYc='
WHERE
key_id = 'a5ed0d1df0e4161e398addc48bcb628d682e7c8541356faf6e941e531bb7cfb0'
AND (
token = 'MsRRdzbm2KzkEbmS66d3maLEfSbsDfl7BSc+fLQgLYc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)