UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z1a46PORIPyYvcW26Sse8Dv94UhIQ3NB5OOID9J8iaA='
WHERE
key_id = '60b731886ed98c89a5b40108252782eff34d2e6eec174deeb75977d9419e4bcc'
AND (
token = 'z1a46PORIPyYvcW26Sse8Dv94UhIQ3NB5OOID9J8iaA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)