UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vIiUL3qNHiPaXYhS91APxDOKw6c+rtVjRxK9OAg6mvY='
WHERE
key_id = 'd0bc3a3a565034799a767809b360f5d3a2e66537752df1f8290aed1bd91822df'
AND (
token = 'vIiUL3qNHiPaXYhS91APxDOKw6c+rtVjRxK9OAg6mvY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)