UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ST/ipd0jDGSpNAiQMojhXukTBVxdnM19mZe2XGwl4Rg='
WHERE
key_id = 'd4a9f8542ce95f14539fabe5a0361f6b47d2923aaf07282b925840c051b9cd6f'
AND (
token = 'ST/ipd0jDGSpNAiQMojhXukTBVxdnM19mZe2XGwl4Rg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)