UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pi8im7KEH0zGC7ZTXe/bd5SAca/2PkaeaQJ9GSxnrhI='
WHERE
key_id = '7d2b847c6de012986c631bd49c43826e30160ac82c45c09978cc6933c40ec397'
AND (
token = 'pi8im7KEH0zGC7ZTXe/bd5SAca/2PkaeaQJ9GSxnrhI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)