UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zRbWrwz5aHtAN6mQtKUfVilzoXgDD22KjriS6RKx+yI='
WHERE
key_id = '54c57f075f1948948beb2ae2003d3d75a05a13c32024fbfbf3a8d5cb1773538a'
AND (
token = 'zRbWrwz5aHtAN6mQtKUfVilzoXgDD22KjriS6RKx+yI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)