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