UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ai4KStFM874QQh+8XJYHNZFsqoDxVND9/y4Imk4MYXo='
WHERE
key_id = '1802e8487deda10243b7d5b63888db98d57fdb83b266dfeece4c12a5af6dbdbe'
AND (
token = 'ai4KStFM874QQh+8XJYHNZFsqoDxVND9/y4Imk4MYXo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)