UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EgltWIi8X+aWl6VhrQZBXE3XNnk04wceRPgJ0ihn4dg='
WHERE
key_id = 'ea2ccee2a805464c3ce52b5a09e8222dbf34f3f9c26c3806744691462110aec1'
AND (
token = 'EgltWIi8X+aWl6VhrQZBXE3XNnk04wceRPgJ0ihn4dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)