UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bsCgK3EsYF4CJwgkHi42A70GZaWumFZwaKQenP9FZO0='
WHERE
key_id = '50cc44a2103ae6b4897c220be3f911a653235131fc95aa4b2d13e22521ff99b8'
AND (
token = 'bsCgK3EsYF4CJwgkHi42A70GZaWumFZwaKQenP9FZO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)