UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '510BkXvNe9QK2zhj+zWn+H3hQwAmCT8MCMbDNdoXBqk='
WHERE
key_id = '150d0492694a1121da159954e0b85ee1d56555b0319a327f55d53f1887586df5'
AND (
token = '510BkXvNe9QK2zhj+zWn+H3hQwAmCT8MCMbDNdoXBqk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)