UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aSBw1t5GF6DCfMDfyM1cp56lzEZGzLs1u9wpG2ZNEeE='
WHERE
key_id = '397f71186f05132fcf955d19f62d02e91906bdf5619451615104a3a43f837b4e'
AND (
token = 'aSBw1t5GF6DCfMDfyM1cp56lzEZGzLs1u9wpG2ZNEeE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)