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