UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y02D0c7JbGJOuDsLZGFy/Of+nasu+4kZTjCZq1s5ids='
WHERE
key_id = 'fa45ba04584e5f84eca835881a87836cd5f3787bbaf450d7326111b2080e4ace'
AND (
token = 'y02D0c7JbGJOuDsLZGFy/Of+nasu+4kZTjCZq1s5ids='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)