UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd9qVCl1EqABFeg9GOHQOSVDObFAIZ9+XwAb1Sw6yepQ='
WHERE
key_id = '87d059be659aa9070893f32a4cb3aa683948561b9ac985b8e09b023d119c8fff'
AND (
token = 'd9qVCl1EqABFeg9GOHQOSVDObFAIZ9+XwAb1Sw6yepQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)