UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HGm6HGpiyZexkZcC23o0gr2Eh2jdeaXjrvDJdi0eMDI='
WHERE
key_id = '9b6480d1f20144360d8ca8666493598f4678094da374195ce56bb56d73a71be7'
AND (
token = 'HGm6HGpiyZexkZcC23o0gr2Eh2jdeaXjrvDJdi0eMDI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)