UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vpiqTJpBMr51Emk+RAGvbIcNVBMWxceUvEr9S+1wDeg='
WHERE
key_id = '3879c0f22e533447e16006abfd382fa840381aa16066a50a332cd46b4a31db1f'
AND (
token = 'vpiqTJpBMr51Emk+RAGvbIcNVBMWxceUvEr9S+1wDeg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)