UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NMVH5ui51eRSbb9lqhrM2skYBVpOGOhQJzRDdiA3Ekw='
WHERE
key_id = '7796f45711ae3cd71d111fcb958886984ce9f2e96e3d28e2ef7936ae97e4938a'
AND (
token = 'NMVH5ui51eRSbb9lqhrM2skYBVpOGOhQJzRDdiA3Ekw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)