UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wEV6cteqimVbgpG99QEimZ/P0S5Zm36rIvF7fIEhwRs='
WHERE
key_id = '2389dc05f7766ed4f02ac7cc45d8598aa7baf196c3376eeb5978e303703a8767'
AND (
token = 'wEV6cteqimVbgpG99QEimZ/P0S5Zm36rIvF7fIEhwRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)