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