UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nY8GTcn9bX65D9drAsODNZ4hnhJ3Po4jzL4Y7/BpgnI='
WHERE
key_id = 'cc6b15113e9f52407f88c4ab7230c7d2d4c9102967fdf1f5950d172f79759df8'
AND (
token = 'nY8GTcn9bX65D9drAsODNZ4hnhJ3Po4jzL4Y7/BpgnI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)