UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kis8R+jKYVjvjaeFSjdKz5iL7R0LmasK1hQtlMbWAUs='
WHERE
key_id = '6dec23948986ca75f7ce2bbb8b9fc75987e664424565d2010576de706959a585'
AND (
token = 'kis8R+jKYVjvjaeFSjdKz5iL7R0LmasK1hQtlMbWAUs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)